<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<style>
	.form-item {
		margin: 20px 10px;
	}
	
	.form-item>label {
		letter-spacing: 3px;
		width: 110px;
		text-align: right;
		display: inline-block;
	}
	
	.form-item>label:AFTER {
		content: ":";
	}
	
	.form-item input[type=text] {
		width: 100px;
	}
	
	.form-item.required>label:BEFORE {
		content: "*";
		color: red;
	}
</style>
<form id="shoukuanForm" method="post" enctype="multipart/form-data">
	<input type="hidden" name="userid" value="${user.userId}">
	<h3 style="text-align: center;margin-top: 20px;">添加收款记录</h3>
	<div class="form-item required">
	<input type="hidden" name="shoukuanid" value="${shoukuanEntity.shoukuanId }"/>
		<label for="">学生班级</label>
		<select data-options="editable:false" name="className"  style="padding: 3px;height:24px;border-radius: 5px;border-color: dodgerblue;" onchange="move(this.value)">
					<option value="">请选择</option>
					<c:forEach items="${classList }" var="list">
						<option value="${list.classId }" ${list.classId==classEntity.classId?'selected':'' }>${list.className }</option>
					</c:forEach>
		</select>&nbsp;&nbsp;&nbsp; 
		
		<label for="">学生姓名</label>
		<input type="hidden" name="studentid" value="${shoukuanEntity.student.stuId }"/> 
		<select id="student" data-options="editable:false" name="studentName" style="padding: 3px;height:24px;border-radius: 5px;border-color: dodgerblue;"   >
					<option value="">请选择</option>
					<c:forEach items="${studentList }" var="list">
						<option value="${list.stuId }" ${list.stuId==studentEntity.stuId?'selected':'' }>${list.studentName }</option>
					</c:forEach>
		</select>
		
		
	</div>
	<div class="form-item required">
		<label for="">收款项目</label>
		<input value="${shoukuanEntity.shouKuanName}" type="text" data-options="required:true" class="easyui-textbox" name="shouKuanName">
		<label style="margin-left: 35px;">是否优惠</label> 是
		<input type="radio" checked="checked"  ${empty shoukuanEntity ||shoukuanEntity.lend=='1' ? 'checked': '' } name="lend" value="1"> 否
		<input type="radio" ${shoukuanEntity.lend=='0' ? 'checked': '' } name="lend" value="0">
	</div>
	<div class="form-item required">
	<label for="">应收金额</label>
		<input value="${shoukuanEntity.shoukuaninfoId.money}" type="text" data-options="required:true" class="easyui-textbox" name="money">
		<label style="margin-left: 35px;">优惠金额</label>
		<input value="${shoukuanEntity.discountMoney}" type="text" data-options="required:true" class="easyui-textbox" name="discountMoney">
	</div>
	<div class="form-item required">
		<label for="">收款金额</label>
		<input value="${shoukuanEntity.shouKuanMoney}" type="text" data-options="required:true" class="easyui-textbox" name="shouKuanMoney">
		<label style="margin-left: 35px;">还欠金额</label>
		<input value="${shoukuanEntity.shoukuaninfoId.owedMoney}" type="text" data-options="required:true" class="easyui-textbox" name="owedMoney">
	</div>
	<div class="form-item required">
		<label for="">支付方式</label>
		<select style="height:24px;border-radius: 5px;border-color: dodgerblue;" name="shouKuanPay"> 
			<option value="支付宝" ${shoukuanEntity.shouKuanPay=='支付宝' ? 'selected' : '' }>支付宝</option>
			<option value="微信" ${shoukuanEntity.shouKuanPay=='微信' ? 'selected' : ''}>微信</option>
			<option value="现金" ${shoukuanEntity.shouKuanPay=='现金' ? 'selected' : ''}>现金</option>
			<option value="银行卡" ${shoukuanEntity.shouKuanPay=='银行卡' ? 'selected' : ''}>银行卡</option>
			<!--优惠金额、是否优惠、优惠原因-->
		</select>
		
		<label for="" style="margin-left: 75px;">收款时间</label>
		<input value="${shoukuanEntity.shoukuaninfoId.payTime}" data-options="required:true" class="easyui-datetimebox" name="payTime">
		
	</div>
	<div style="margin-left:85px;">
		<label for="" style="margin-left: 35px;">优惠原因</label>
		<input value="${shoukuanEntity.discountReason}" style="width: 300px;height: 100px;" type="text" class="easyui-textbox" data-options="multiline:true" name="discountReason">
		<br/>
		<br/>
		<label for="" style="margin-left: 35px;">收款凭证</label>
		<input name="file" type="file" style="margin-top:-10px" data-options="required:true" />
	</div>
	<div class="form-item">
		<input type="hidden" name="shoukuaninfo" value="${shoukuanEntity.shoukuaninfoId.shoukuanInfoId }"/>
		<label for="" style="margin-left: 35px;">备注</label>
		<input value="${shoukuanEntity.shoukuaninfoId.addPlus}" style="width: 300px;height: 100px;" type="text" class="easyui-textbox" data-options="multiline:true" name="addPlus">
	</div>


</form>
<script>
	function move(obj) {
		
		var id=obj;
		var optionString = "";
		 $.get("caiwu/teamcontent/" + id, function(rs) {
				if (rs.success) {
					var data=rs.message;
					for (var i = 0; i < data.length; i++) {
							 optionString +="<option grade=\""+data[i].stuId+"\" value=\""+data[i].stuId+"\"";  
		                      optionString += ">"+data[i].studentName+"</option>";  //动态添加数据  
					}
					 $("select[id=student]").empty();
					 $("select[id=student]").append(optionString);
				}else{
					$.message.alert("提示错误！")
				}
			});
	}
</script>